//
//  ZYPresentationController.m
//  ShareParking
//
//  Created by STAR on 2017/10/30.
//  Copyright © 2017年 zjw. All rights reserved.
//

#import "ZYPresentationController.h"

@interface ZYPresentationController()
@property (nonatomic, strong) UIButton *backBtn;
@end
@implementation ZYPresentationController

- (instancetype)initWithPresentedViewController:(UIViewController *)presentedViewController presentingViewController:(UIViewController *)presentingViewController {
    self = [super initWithPresentedViewController:presentedViewController presentingViewController:presentingViewController];
    if (self) {
    }
    return self;
}
- (void)containerViewWillLayoutSubviews {
    [super containerViewWillLayoutSubviews];
//    self.presentedView.frame = CGRectMake(0, 64, self.containerView.frame.size.width, 120);
    self.presentedView.frame = self.presentFrame;
    [self.containerView insertSubview:self.backBtn atIndex:0];
}
- (UIButton *)backBtn {
    if (!_backBtn) {
        _backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _backBtn.frame = self.containerView.frame;
        _backBtn.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
        [_backBtn addTarget:self action:@selector(backVC) forControlEvents:UIControlEventTouchUpInside];
        }
    return _backBtn;
}
- (void)backVC {
    [self.presentedViewController dismissViewControllerAnimated:YES completion:nil];
    //DLog(@"%@+++%@",self.presentedViewController,self.presentingViewController);
}
@end
